<!DOCTYPE html>
<title>{% block title %}{% endblock %}</title>
<!-- 新 Bootstrap5 核心 CSS 文件 -->
<link rel="stylesheet" href="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/twitter-bootstrap/5.1.3/css/bootstrap.min.css">
<!--  popper.min.js 用于弹窗、提示、下拉菜单 -->
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/popper.js/2.11.2/umd/popper.min.js"></script>
<!-- 最新的 Bootstrap5 核心 JavaScript 文件 -->
<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/twitter-bootstrap/5.1.3/js/bootstrap.min.js"></script><body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container-fluid">
            <a class="navbar-brand" href="{{ url_for('room.index') }}">
                <h1>网站标题</h1>
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse justify-content-end" id="navbarNav">
                <ul class="navbar-nav">
                    {% if g.user %}
                        <li class="nav-item">
                            <span>{{ g.user['username'] }}</span>
                        </li>
                        <li class="nav-item">
                            <a href="{{ url_for('auth.logout') }}" class="nav-link active">登出</a>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a href="{{ url_for('auth.register') }}" class="nav-link active">注册</a>
                        </li>
                        <li class="nav-item">
                            <a href="{{ url_for('auth.login') }}" class="nav-link active">登录</a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <section class="content">
        <header>
            {% block header %}{% endblock %}
        </header>
        {% for message in get_flashed_messages() %}
            <div class="alert alert-warning alert-dismissible fade show" role="alert">
                {{ message }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        {% endfor %}
        {% block content %}{% endblock %}
    </section>
</body>